ContextCapture User Guide

References by ID

The 3MXB file includes several resources, all of which have to be matched together. As mentioned before, the resource ID is used to link nodes and resources together.

The first correspondence is between the node and its geometry. The node data includes a resources array, enumerating the IDs of every geometry resource belonging to the node. The header's resource array lists all the resources needed by at least one node in the file. By matching the node's resource IDs with the header resource IDs, the node's geometry can be reconstructed.

In the image below, Node 0 has Resource 0 and Resource 1 as geometries. While Resource 0 is of type geometry file, Resource 1 is of type geometry buffer, and the mesh is packed in Buffer 0. Node 1 is defined by the Resource 2 geometry, found in Buffer 1. The order of resource appearance in the header is preserved for the buffers, so the attribution of Buffer 1 to Resource 2 is done automatically.

Resource attribution in 3MXB. The green color represents binary data, and the blue nuances represent string data.

A geometry belongs to a single node, but a node can have zero, one or several geometry meshes. The reasons for the node having more than one geometry are twofold. In the first place, a single node can have textured and un-textured data or data textured with several images. In this case it is convenient to separate the geometry in several buffers, each corresponding to a single texture. In the second place, certain systems impose a geometry buffer of at most MAX_USHORT length. For instance, when produced for the WebGL viewer, the geometry is split into buffers no larger than MAX_USHORT (65,535). This can be adapted to the targeted viewer.

The second correspondence is between the geometry mesh and the corresponding texture. The resource ID is again used for the matching. A geometry mesh can have either a single texture or none at all. If a texture is needed, the "texture" tag is present in the geometry description. The indicated texture ID should be the ID of one of the texture resources listed in the header’s resource collection.

A texture can be used in different nodes, and by several geometries. In our example above, Resource 0 and Resource 2 both share the texture in Resource p.

A header complete example, in JSON format:

{ 
   "version":1,
   "nodes":[ 
      { 
         "id":"node0",
         "bbMin":[28.7803, -12.6859, 17.3977],
         "bbMax":[30.7065, -2.68368, 28.2069],
         "maxScreenDiameter":118.819,
         "children": [ "Tile_p000_p000_p001_L20_00.3mxb"],
         "resources":[ "geometry0"]
      }
   ],
   "resources":[ 
      { 
         "type":"textureBuffer",
         "format":"jpg",
         "id":"texture0",
         "size":1665
      },
      { 
         "type":"geometryBuffer",
         "format":"ctm",
         "id":"geometry0",
         "texture":"texture0",
         "bbMin":[28.7803, -12.6859, 17.3977],
         "bbMax":[30.7065, -2.68368, 28.2069],
         "size":1233
      }
   ]
}